<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
	*{
		padding: 0;
		margin: 0;
	}
	img{
		display: block;
		margin: 0 auto;
	}
</style>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
	
$(function(){

	// 给window加滚动条事件
	$(window).scroll(function() {
		// 获得已滚动上去的高度
		var t = $(window).scrollTop();
		document.title = t;
		if(t>121){
			// 计算导航条的left
			// (可视区域宽度-导航宽度)/2
			var l = ($(window).width() - $('#menu').width())/2;
			// 让导航固定
			$('#menu').css({'position':'fixed','top':'0','left':l+'px'});
		}else{
			$('#menu').css('position', 'static');
		}
	});
	
})


</script>
</head>

<body>

<img src="1.jpg" alt="" />
<img src="2.jpg" id="menu" />
<img src="3.jpg" alt="" />

</body>
</html>
